# -*- coding: utf-8 -*-

"""
Initial conditions for standard tests

"""

import math

def add_outer_solar_system(sim):
    """
    Add the planet of the outer Solar System as a test problem.
    Data taken from NASA Horizons.
    """
    Gfac = 1./0.01720209895       # Gaussian constant 
    if sim.G is not None:
        Gfac *= math.sqrt(sim.G)

    sim.add( m=1.00000597682, x=-4.06428567034226e-3, y=-6.08813756435987e-3, z=-1.66162304225834e-6, vx=+6.69048890636161e-6*Gfac, vy=-6.33922479583593e-6*Gfac, vz=-3.13202145590767e-9*Gfac )  # Sun
    sim.add( m=1./1047.355,   x=+3.40546614227466e+0, y=+3.62978190075864e+0, z=+3.42386261766577e-2, vx=-5.59797969310664e-3*Gfac, vy=+5.51815399480116e-3*Gfac, vz=-2.66711392865591e-6*Gfac )  # Jupiter
    sim.add( m=1./3501.6,     x=+6.60801554403466e+0, y=+6.38084674585064e+0, z=-1.36145963724542e-1, vx=-4.17354020307064e-3*Gfac, vy=+3.99723751748116e-3*Gfac, vz=+1.67206320571441e-5*Gfac )  # Saturn
    sim.add( m=1./22869.,     x=+1.11636331405597e+1, y=+1.60373479057256e+1, z=+3.61783279369958e-1, vx=-3.25884806151064e-3*Gfac, vy=+2.06438412905916e-3*Gfac, vz=-2.17699042180559e-5*Gfac )  # Uranus
    sim.add( m=1./19314.,     x=-3.01777243405203e+1, y=+1.91155314998064e+0, z=-1.53887595621042e-1, vx=-2.17471785045538e-4*Gfac, vy=-3.11361111025884e-3*Gfac, vz=+3.58344705491441e-5*Gfac )  # Neptune
    sim.add( m=7.4074074e-09, x=-2.13858977531573e+1, y=+3.20719104739886e+1, z=+2.49245689556096e+0, vx=-1.76936577252484e-3*Gfac, vy=-2.06720938381724e-3*Gfac, vz=+6.58091931493844e-4*Gfac )  # Pluto

def add_solar_system(sim):
    """
    Add all planets of the Solar System as a test problem.
    Data taken from NASA Horizons.
    """
    sim.add(m=1.00000000000000000000, x=-0.00583761661678666201, y=0.00660036108188146939, z=0.00008090699630593683, vx=-0.00043778026915688127, vy=-0.00027688340567327781, vz=0.00001289781032896905)
    sim.add(m=0.00000016601141530543, x=-0.29485531126658365286, y=-0.34334233225957377922, z=-0.00200264586836620137, vx=0.92896432258229966195, vy=-0.96594579119516865706, vz=-0.16415293821738913271)
    sim.add(m=0.00000244783828778477, x=0.47227261050357943750, y=0.54819205023577255442, z=-0.02007680147008551394, vx=-0.88553481794279420569, vy=0.77279164698675262279, vz=0.06169738346121213246)
    sim.add(m=0.00000304043264802264, x=0.97541936428768183376, y=-0.22011750964499116057, z=0.00008866761098092638, vx=0.20842772535763168240, vy=0.97042888227470602835, vz=-0.00003307038073776142)
    sim.add(m=0.00000032271560375550, x=1.38489786417060911639, y=-0.00373655464561763921, z=-0.03425238653564356694, vx=0.03680838810437889880, vy=0.88267192839777131042, vz=0.01760188515939473466)
    sim.add(m=0.00095479191521124043, x=2.31793441229397512160, y=-4.57278216881576948794, z=-0.03288979300198136002, vx=0.38587103958050272823, vy=0.21916457142972819994, vz=-0.00954142828183331820)
    sim.add(m=0.00028588567272224167, x=4.97984063350991323915, y=-8.66630842281542435046, z=-0.04756566088166765821, vx=0.26314427785251254255, vy=0.16073015466677914587, vz=-0.01327326395768535505)
    sim.add(m=0.00004366243735831270, x=15.62435177921100226683, y=12.13892823277256738379, z=-0.15733112984491792741, vx=-0.14195568334904265506, vy=0.16989920313154410758, vz=0.00247006450290807337)
    sim.add(m=0.00005151383772628674, x=29.39189844361883885426, y=-5.57834279640134234057, z=-0.56249012217889071685, vx=0.03281663353639149155, vy=0.18036894277947276843, vz=-0.00447061619870956460)
